#!/bin/bash
echo "start settting system parameters"

sed -i '/kernel.shmmax/d' /etc/sysctl.conf
sed -i '/kernel.shmmin/d' /etc/sysctl.conf
sed -i '/kernel.shmall/d' /etc/sysctl.conf
sed -i '/kernel.sem/d' /etc/sysctl.conf
sed -i '/kernel.sysrq/d' /etc/sysctl.conf
sed -i '/kernel.core_uses_pid/d' /etc/sysctl.conf
sed -i '/kernel.msgmnb/d' /etc/sysctl.conf
sed -i '/kernel.msgmax/d' /etc/sysctl.conf
sed -i '/kernel.msgmni/d' /etc/sysctl.conf
sed -i '/net.ipv4.tcp_syncookies/d' /etc/sysctl.conf
sed -i '/net.ipv4.ip_forward/d' /etc/sysctl.conf
sed -i '/net.ipv4.conf.default.accept_source_route/d' /etc/sysctl.conf
sed -i '/net.ipv4.tcp_tw_recycle/d' /etc/sysctl.conf
sed -i '/net.ipv4.tcp_max_syn_backlog/d' /etc/sysctl.conf
sed -i '/net.ipv4.conf.all.arp_filter/d' /etc/sysctl.conf
sed -i '/net.ipv4.ip_local_port_range/d' /etc/sysctl.conf
sed -i '/net.core.netdev_max_backlog/d' /etc/sysctl.conf
sed -i '/net.core.rmem_max/d' /etc/sysctl.conf
sed -i '/net.core.wmem_max/d' /etc/sysctl.conf
sed -i '/vm.overcommit_memory/d' /etc/sysctl.conf

sed -i '$a\kernel.shmmax = 500000000' /etc/sysctl.conf
sed -i '$a\kernel.shmmni = 4096' /etc/sysctl.conf
sed -i '$a\kernel.shmall = 4000000000' /etc/sysctl.conf
sed -i '$a\kernel.sem = 250 512000 100 2048' /etc/sysctl.conf
sed -i '$a\kernel.sysrq = 1' /etc/sysctl.conf
sed -i '$a\kernel.core_uses_pid = 1' /etc/sysctl.conf
sed -i '$a\kernel.msgmnb = 65536' /etc/sysctl.conf
sed -i '$a\kernel.msgmax = 65536' /etc/sysctl.conf
sed -i '$a\kernel.msgmni = 2048' /etc/sysctl.conf
sed -i '$a\net.ipv4.tcp_syncookies = 1' /etc/sysctl.conf
sed -i '$a\net.ipv4.ip_forward = 0' /etc/sysctl.conf
sed -i '$a\net.ipv4.conf.default.accept_source_route = 0' /etc/sysctl.conf
sed -i '$a\net.ipv4.tcp_tw_recycle = 1' /etc/sysctl.conf
sed -i '$a\net.ipv4.tcp_max_syn_backlog = 4096' /etc/sysctl.conf
sed -i '$a\net.ipv4.conf.all.arp_filter = 1' /etc/sysctl.conf
sed -i '$a\net.ipv4.ip_local_port_range = 10000 65535' /etc/sysctl.conf
sed -i '$a\net.core.netdev_max_backlog = 10000' /etc/sysctl.conf
sed -i '$a\net.core.rmem_max = 2097152' /etc/sysctl.conf
sed -i '$a\net.core.wmem_max = 2097152' /etc/sysctl.conf
sed -i '$a\vm.overcommit_memory = 42' /etc/sysctl.conf
cat /etc/sysctl.conf



